﻿'==================================================='
' IpOffice DevLinken Wrapper for DotNet programmer  '
' Author : Giulio martino                           '
' Email  : giulio.martino@voipexperts.it            '
' Date   : 2012-12-12                               '
'==================================================='
Namespace DevLinkNet

    ''' <summary>
    ''' Set call Log Event Type Base or Advanced
    ''' </summary>
    ''' <remarks></remarks>
    ''' 
    Public Enum CallLogType
        Base = 0
        Advavanced = 1
        BaseAndAdvanced = 2
    End Enum

    Namespace Connection_Parameter
        ''' <summary>
        ''' Define Argument for Connection Status Event
        ''' </summary>
        ''' <remarks></remarks>
        Public Class Connection_Status_Paramenter
            Property IdPbx As Integer
            Property StatusMessage As String
            Property ErrorLevel As Connection_Enum.ErrorLevel
            Property Status As CommsEvent_Enum.CommsEvent_State
        End Class

    End Namespace

    Namespace Connection_Enum
        Public Enum ErrorLevel
            ' Fields
            ignore = 0
            info = 1
            warning = 2
            fatal = 3
        End Enum

    End Namespace

    Namespace CommsEvent_Enum
        ''' <summary>
        ''' Define Comms Event Return Value
        ''' </summary>
        ''' <remarks></remarks>
        Public Enum CommsEvent_State

            ''' <summary>
            ''' Communications established. This occurs either after the
            ''' initial call to DLOpen(), or after the system unit has come
            ''' back on-line after being powered off or rebooted.
            ''' </summary>
            ''' <remarks></remarks>
            DEVLINK_COMMS_OPERATIONAL = 0


            ''' <summary>
            ''' No response from system unit. This occurs either after the
            ''' initial call to DLOpen(), or if the system unit is powered off
            ''' or rebooted. It can also occur if network problems prevent
            ''' </summary>
            ''' <remarks></remarks>
            DEVLINK_COMMS_NORESPONSE = 1


            ''' <summary>
            ''' Reserved for future use
            ''' </summary>
            ''' <remarks></remarks>
            DEVLINK_COMMS_REJECTED = 2



            ''' <summary>
            ''' Packets were generated by the IP Office system unit, but
            ''' were not received by DevLink. This can occur either
            ''' because the IP Office system unit is under heavy load, or
            ''' because the application using DevLink did not return from
            ''' a callback quickly enough. Applications should ensure
            ''' that they do not take more than 100 milliseconds to
            ''' process events.
            ''' </summary>
            ''' <remarks></remarks>
            DEVLINK_COMMS_MISSEDPACKETS = 3
        End Enum

    End Namespace

    Namespace CommsEvents_Parameter
        Public Class CommEvent
            'Inherits System.EventArgs
            Public IdPbx As Integer
            Public comm_state As CommsEvent_Enum.CommsEvent_State
            Public parm1 As Integer
        End Class
    End Namespace

    Namespace CallLogEvent_S_Enum
        Public Enum StateCode
            Idle = 0
            Ringing = 1
            Connected = 2
            Disconnected = 3
            Suspending = 4
            Suspended = 5
            Resuming = 6
            Dialling = 7
            Dialled = 8
            Local_Dial = 9
            Queued = 10
            Parked = 11
            Held = 12
            Redialling = 13

        End Enum

        Public Enum CauseCode
            CMCauseUnknown = 0

            ''' <summary>
            '''  The number is not in the dial plan
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseUnallocatedNumber = 1

            ''' <summary>
            ''' Force clear down unconditionally
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseForceIdle = 2

            ''' <summary>
            ''' Indicate the operation is for unregistration procedure
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseUnregister = 3

            CMCauseNormal = 16

            ''' <summary>
            ''' The call target is busy
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseBusy = 17


            CMCauseNoUserResponding = 18

            ''' <summary>
            ''' The call has not been permitted, e.g. call barring
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseCallRejected = 21

            CMCauseNormalUnspecified = 31

            ''' <summary>
            ''' There is no available external line
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseNoChannel = 34

            ''' <summary>
            ''' Problem with the external network
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseNetworkOOO = 38
            CMCauseIncompatible = 88
            CMCausePhoneInfo = 113

            ''' <summary>
            ''' The call has returned because it was parked against a
            ''' busy extension that is now free
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseReminderFree = 114

            ''' <summary>
            ''' The call has returned because it was not answered within
            ''' the transfer return timeout
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseReminderNoAns = 115

            CMCauseE911Emergency = 116
            CMCauseParked = 117
            CMCauseUnParked = 118
            CMCausePickup = 119

            ''' <summary>
            ''' A held or parked call is returning due to a hold / park
            ''' timeout
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseReminder = 120

            ''' <summary>
            ''' The call has been redirected
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseRedirect = 121

            ''' <summary>
            ''' The call was barred
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseCallBarred = 122

            ''' <summary>
            ''' The call has been forwarded to voicemail
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseForwardToVoicemail = 123

            ''' <summary>
            ''' The call has been answered by someone else
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseAnsweredByOther = 124

            ''' <summary>
            ''' The call has not been allowed because a valid account
            ''' code has not been provided
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseNoAccountCode = 125

            ''' <summary>
            ''' The call has been transferred
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseTransfer = 126

            ''' <summary>
            ''' The call has been placed into a conference
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseConferencingMove = 127
            CMCauseRestrictedToPartner = 128
            CMCauseHeldCall = 129
            CMRingBackCheck = 130

            ''' <summary>
            ''' The call was answered on an appearance button on
            ''' another phone
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseAppearanceCallSteal = 131

            CMCauseAppearanceBridgeInto = 132
            ''' <summary>
            ''' The call is no longer the primary call, i.e. it is now a waiting
            ''' call
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseBumpedCall = 133

            CMCauseLineAppearanceCall = 134
            CMCauseUnheldCall = 135
            CMCauseReplaceCurrentCall = 136
            CMCauseGlare = 137

            ''' <summary>
            ''' The call has been placed into a conference
            ''' </summary>
            ''' <remarks></remarks>
            CMCauseR21CompatConfMove = 138
        End Enum
    End Namespace

    Namespace CallLogEvent_Type
        Public Class CallLogEvent_S
            ''' <summary>
            ''' Call id for the A end of the call
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property AcallId As String

            ''' <summary>
            ''' Call id for the B end of the call
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property BcallId As String

            ''' <summary>
            ''' State of the A end of the call. Valid numbers are:
            ''' </summary>
            ''' <value>
            '''  0 Idle
            '''  1 Ringing
            '''  2 Connected
            '''  3 Disconnected
            '''  4 Suspending
            '''  5 Suspended
            '''  6 Resuming
            '''  7 Dialling
            '''  8 Dialled
            '''  9 Local Dial
            ''' 10 Queued
            ''' 11 Parked
            ''' 12 Held
            ''' 13 Redialling
            ''' </value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property Astate As CallLogEvent_S_Enum.StateCode

            ''' <summary>
            ''' State of the B end of the call – see above for values. If there is
            ''' no B end, this will be 0 (Idle)
            ''' </summary>
            ''' <value>
            '''  0 Idle
            '''  1 Ringing
            '''  2 Connected
            '''  3 Disconnected
            '''  4 Suspending
            '''  5 Suspended
            '''  6 Resuming
            '''  7 Dialling
            '''  8 Dialled
            '''  9 Local Dial
            ''' 10 Queued
            ''' 11 Parked
            ''' 12 Held
            ''' 13 Redialling
            ''' </value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property Bstate As CallLogEvent_S_Enum.StateCode

            ''' <summary>
            ''' 0 indicates not connected to the switch (e.g. If receiving dialtone)
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property Aconnected As Integer

            ''' <summary>
            ''' Indicates whether the A end of the call is listening to music on
            ''' hold
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property AisMusic As Integer

            ''' <summary>
            ''' 0 indicates not connected to the switch (e.g. If receiving dialtone)
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property Bconnected As Integer

            ''' <summary>
            ''' Indicates whether the B end of the call is listening to music on hold
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property BisMusic As Integer

            ''' <summary>
            ''' Name of the A end of the call. The format of this string is:
            ''' For extensions: Name (Number)
            ''' For trunks: Line number
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property Aname As String

            ''' <summary>
            ''' Name of the B end of the call. The format of this string is:
            ''' For extensions: Name (Number)
            ''' For trunks: Line number
            ''' If there is no B end, this will be empty.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property Bname As String
            ''' <summary>
            ''' List of possible targets for the call. Targets are separated by
            ''' semicolons, and if there are more than four, the list is terminated
            ''' after 4 elements with an ellipsis.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property Blist As String

            ''' <summary>
            ''' Aslot is the slot number of the A side of the call and is the identify
            ''' of the TDM trunk.
            ''' Achannel is the channel number within the Aslot.
            ''' The format of the string is "Number.Number".
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property AslotAchannel As String


            ''' <summary>
            ''' Bslot is the slot number of the B side of the call and is the identify
            ''' of the TDM trunk.
            ''' Bchannel is the channel number within the Bslot.
            ''' The format of the string is "Number.Number".
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property BslotBchannel As String


            ''' <summary>
            ''' This field contains two numbers: 1) an indicator of how the called
            ''' party details should be presented, and 2) the type of data to be
            ''' found in the called party number field.
            ''' The format of the string is "Number.Number".
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property CalledPartyPresentation As String

            ''' <summary>
            ''' The identifier or number of the called party.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property CalledPartyNumber As String

            ''' <summary>
            ''' This field contains two numbers: 1) an indicator of how the
            ''' calling party details should be presented, and 2) the type of data
            ''' to be found in the calling party number field.
            ''' The format of the string is "Number.Number".
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property CallingPartyPresentationType As String



            ''' <summary>
            ''' The identifier or number of the calling party.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property CallingPartyNumber As String

            ''' <summary>
            ''' The sub address of the called party.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property CalledSubAddress As String

            ''' <summary>
            ''' The sub address of the calling party.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property CallingSubAddress As String

            ''' <summary>
            '''  The type of data to be found in the dialled party number field.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property DialledPartyType As Integer

            ''' <summary>
            ''' The identifier or number of the dialled party.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property DialledPartyNumber As String

            ''' <summary>
            '''  The type of data to be found in the keypad number field.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property KeypadType As Integer

            ''' <summary>
            '''  String The dialled digits.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property KeypadNumber As String

            ''' <summary>
            ''' The number of times this call has been presented to a target.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property RingAttemptCount As Integer

            ''' <summary>
            ''' The reason the call is in it's current state. See the table below for
            ''' further details.
            ''' </summary>
            ''' <value>
            '''   0 CMCauseUnknown
            '''   1 CMCauseUnallocatedNumber The number is not in the dial plan
            '''   2 CMCauseForceIdle Force clear down unconditionally
            '''   3 CMCauseUnregister Indicate the operation is for unregistration procedure
            '''  16 CMCauseNormal
            '''  17 CMCauseBusy The call target is busy
            '''  18 CMCauseNoUserResponding
            '''  21 CMCauseCallRejected The call has not been permitted, e.g. call barring
            '''  31 CMCauseNormalUnspecified
            '''  34 CMCauseNoChannel There is no available external line
            '''  38 CMCauseNetworkOOO Problem with the external network
            '''  88 CMCauseIncompatible
            ''' 113 CMCausePhoneInfo
            ''' 114 CMCauseReminderFree The call has returned because it was parked against a
            '''     busy extension that is now free
            ''' 115 CMCauseReminderNoAns The call has returned because it was not answered within
            ''' the transfer return timeout
            ''' 116 CMCauseE911Emergency
            ''' 117 CMCauseParked
            ''' 118 CMCauseUnParked
            ''' 119 CMCausePickup
            ''' 120 CMCauseReminder A held or parked call is returning due to a hold / park
            '''     timeout
            ''' 121 CMCauseRedirect The call has been redirected
            ''' 122 CMCauseCallBarred The call was barred
            ''' 123 CMCauseForwardToVoicemail The call has been forwarded to voicemail
            ''' 124 CMCauseAnsweredByOther The call has been answered by someone else
            ''' 125 CMCauseNoAccountCode The call has not been allowed because a valid account
            '''     code has not been provided
            ''' 126 CMCauseTransfer The call has been transferred
            ''' 127 CMCauseConferencingMove The call has been placed into a conference
            ''' 128 CMCauseRestrictedToPartner
            ''' 129 CMCauseHeldCall
            ''' 130 CMRingBackCheck
            ''' 131 CMCauseAppearanceCallSteal The call was answered on an appearance button on
            '''     another phone
            ''' 132 CMCauseAppearanceBridgeInto
            ''' 133 CMCauseBumpedCall The call is no longer the primary call, i.e. it is now a waiting
            '''     call
            ''' 134 CMCauseLineAppearanceCall
            ''' 135 CMCauseUnheldCall
            ''' 136 CMCauseReplaceCurrentCall
            ''' 137 CMCauseGlare
            ''' 138 CMCauseR21CompatConfMove The call has been placed into a conference
            ''' </value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property Cause As CallLogEvent_S_Enum.CauseCode

            ''' <summary>
            '''  1 if the call cannot divert to voice mail.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            ''' 
            Property VoicemailDisallow As Integer

            ''' <summary>
            '''  1 if overlap dialling is complete.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property SendingComplete As Integer

            ''' <summary>
            ''' This field contains two numbers: 1) call type, e.g. speech, video
            ''' and 2) the transport type, 0=circuit, 2=packet.
            ''' The format of the string is "Number.Number".
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property CallTypeTransportType As String

            ''' <summary>
            ''' The name of the hunt group where the call is currently queued.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property OwnerHuntGroupName As String

            ''' <summary>
            ''' The name of the hunt group where the call was originally
            ''' targeted.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property OriginalHuntGroupName As String

            ''' <summary>
            ''' The name of the user where the call was originally targeted.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property OriginalUserName As String

            ''' <summary>
            ''' The name of the hunt group where the call has been targeted at.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property TargetHuntGroupName As String

            ''' <summary>
            ''' Name of user to which the call is being targeted.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property TargetUserName As String

            ''' <summary>
            ''' The name of the internal port where the call is being targeted.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property TargetRASName As String

            ''' <summary>
            ''' 1 the call is internal, otherwise 0.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property IsInternalCall As Integer

            ''' <summary>
            ''' The time the call was created (internal tick count).
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property TimeStamp As String

            ''' <summary>
            ''' The time the call was connected.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property ConnectedTime As Integer

            ''' <summary>
            ''' The time the call started ringing.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property RingTime As Integer

            ''' <summary>
            ''' The duration the call has been connected or was connected for.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property ConnectedDuration As Integer

            ''' <summary>
            ''' The duration the call has been ringing or was ringing for.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property RingDuration As Integer

            ''' <summary>
            ''' Locale identifier (same as the locale setting in Manager).
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property Locale As String

            ''' <summary>
            ''' When the call is parked, the B end is undefined, and this field
            ''' contains the park slot number.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property ParkSlotNumber As String

            ''' <summary>
            ''' 1 if the call is a call waiting call
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property CallWaiting As String

            ''' <summary>
            ''' Contains the tag, which may be applied through TAPI, Voice
            ''' Mail/Pro or SoftConsole.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property Tag As String

            ''' <summary>
            ''' Non-zero indicates that the call is being transferred.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property Transferring As String

            ''' <summary>
            ''' Non-zero if the service is active.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property ServiceActive As Integer

            ''' <summary>
            ''' Non-zero if the service quota is used.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property ServiceQuotaUsed As Integer

            ''' <summary>
            ''' The service quota time.
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property ServiceQuotaTime As Integer

            ''' <summary>
            ''' The account code of the call, if any
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property AccountCode As String

            ''' <summary>
            ''' Unique call id
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property CallID As Integer

        End Class

        Public Class CallLogEvent_D
            ''' <summary>
            ''' Call id for the A end of the call
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property AcallId As String

            ''' <summary>
            ''' Call id for the B end of the call
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property BcallId As String

            ''' <summary>
            ''' Unique call id
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property CallID As Integer
        End Class

        Public Class CallLogEvent_A
            ''' <summary>
            ''' Call id for the A end of the call
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property AcallId As String

            ''' <summary>
            ''' Call id for the B end of the call
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property BcallId As String

            ''' <summary>
            ''' Unique call id
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            Property CallID As Integer
        End Class
    End Namespace

    Namespace CallLogEvent_Parameter
        ''' <summary>
        ''' Parameter for Call Event Type S
        ''' S events are sent whenever a call is first created, 
        ''' and whenever any part of the call changes state.
        ''' </summary>
        ''' <remarks></remarks>
        Public Class CallLog_S_Parameter
            'Inherits System.EventArgs
            Public IdPbx As Integer
            Public LogInfo As CallLogEvent_Type.CallLogEvent_S
        End Class
        ''' <summary>
        ''' Event for call Type A
        ''' </summary>
        ''' <remarks></remarks>
        Public Class CallLog_A_Parameter
            'Inherits System.EventArgs
            Public IdPbx As Integer
            Public LogInfo As CallLogEvent_Type.CallLogEvent_A

        End Class
        ''' <summary>
        ''' Event for call Type D
        ''' </summary>
        ''' <remarks></remarks>
        Public Class CallLog_D_Parameter
            Inherits System.EventArgs
            Public IdPbx As Integer
            Public LogInfo As CallLogEvent_Type.CallLogEvent_D
        End Class

        Public Class CallLog_Base_Parameter
            'Inherits System.EventArgs
            Public IdPbx As Integer
            Public LogInfo As String
        End Class
    End Namespace

End Namespace

